##!/usr/bin/python
## -*- coding: utf-8 -*-
## Description: RichTextField
## Create: 2008-6-5
## Author: MK2[fengmk2@gmail.com]
##from django import oldforms
#from django import forms
#from django.db.models.fields import TextField
#from django.utils.safestring import mark_safe
#from django.utils.html import escape
#
#class LargeTextField(TextField):
#    """admin会使用到
#    
#    >>> LargeTextField()
#    awd
#    """
#    def __init__(self, field_name, rows=10, cols=40, is_required=False, validator_list=None, max_length=None):
#        if validator_list is None: validator_list = []
#        self.field_name = field_name
#        self.rows, self.cols, self.is_required = rows, cols, is_required
#        self.validator_list = validator_list[:]
#        if max_length:
#            self.validator_list.append(self.isValidLength)
#            self.max_length = max_length
#
#    def render(self, data):
#        if data is None:
#            data = ''
#        return mark_safe(u'<textarea id="%s" class="%s%s" name="%s" rows="%s" cols="%s">%s</textarea>' % \
#            (self.get_id(), u'richTextEditor', self.is_required and u' required' or u'',
#            self.field_name, self.rows, self.cols, escape(data)))
#        
#class RichTextField(TextField):
#    def get_manipulator_field_objs(self):
#        """admin会调用"""
#        return [LargeTextField]
#    
#    def formfield(self, **kwargs):
#        defaults = {'widget': forms.Textarea(attrs={'class':'richTextEditor'})}
#        defaults.update(kwargs)
#        return super(RichTextField, self).formfield(**defaults)